import requests
from config import url, headers_web


class IndicatorDimensionMaterial:
    def __init__(self):
        self.url = url
        self.headers_web = headers_web

    @classmethod
    def get_indicator_audit_record(cls, url: str, params=None, headers=headers_web, params_path=None):
        """
        @Summary: 获取指标维度审核记录接口
        @Description: 1.云课堂管理端-本科教学评估使用
        :param params_path: "id": "string"  #指标资料ID
        :param headers: {
                          "Content-Type":"application/json",
                          "X-Requested-With":"XMLHttpRequest",
                          "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64)
                          AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36"
                        }
        :param url: http://192.168.1.32:8080
        :param params: {validCode: "string" #验证码（id={}&signKey=123123）}
        :return: [{"auditStatus": integer, #审核状态：0-退回，1-未确认，2-已确认
                    "id": "string", #审核记录ID
                    "operationTime": "string", #操作时间
                    "operatorId": "string", #操作人Id
                    "operatorName": "string", #操作人姓名
                    "operatorNo": "string", #操作人工号
                    "remark": "string" #备注信息
                 }]
        """
        url_path = url + f"/teachingqualityevaluationapi/v1/indicatordimensionmaterial/{params_path}/audit/record"
        r = requests.get(url=url_path, headers=headers, params=params)
        return r

    @classmethod
    def post_third_indicator_excel_export(cls, url: str, params=None, body=None, headers=headers_web):
        """
        @Summary: 三级指标维度资料指标导出
        @Description: 1、云课堂管理端指标维度资料调用
        :param headers: {
                          "Content-Type":"application/json",
                          "X-Requested-With":"XMLHttpRequest",
                          "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64)
                          AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36"
                        }
        :param url: http://192.168.1.32:8080
        :param params: {validCode: string #验证码（&signKey=123123）}
        :param body: {
                      "auditStatus": integer, #审核状态：0-审核退回，1-院长未确认，2-院长已确认
                      "collegeId": "string", #部门id
                      "isTeachingQualityEvaluationAdmin": boolean, #是否校管理员 0：否；1：是
                      "operatorId": "string", #操作人ID
                      "page": integer, #当前页码
                      "pageSize": integer, #每页记录数
                      "primaryIndicator": "string", #一级指标
                      "secondaryIndicator": "string", #二级指标
                      "thirdIndicator": "string", #三级指标
                      "upload": boolean #是否上传
                    }
        :return:
        """
        url_path = url + f"/teachingqualityevaluationapi/v1/thirdindicator/excel/export"
        r = requests.post(url=url_path, headers=headers, params=params, json=body)
        return r

    @classmethod
    def post_third_indicator_file_download(cls, url: str, params=None, body=None, headers=headers_web):
        """
        @Summary: 三级指标维度资料文件下载接口
        @Description: 1、云课堂管理端指标维度资料调用
        :param headers: {
                          "Content-Type":"application/json",
                          "X-Requested-With":"XMLHttpRequest",
                          "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64)
                          AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36"
                        }
        :param url: http://192.168.1.32:8080
        :param params: {validCode: string #验证码（&signKey=123123）}
        :param body: {
                      "auditStatus": integer, #审核状态：0-审核退回，1-院长未确认，2-院长已确认,3-全部
                      "collegeId": "string", #部门id
                      "isTeachingQualityEvaluationAdmin": boolean, #是否校管理员 0：否；1：是
                      "operatorId": "string", #操作人ID
                      "packagingMethod": integer, #打包方式（按学院打包：0，按指标打包：1）
                      "primaryIndicator": "string", #一级指标
                      "secondaryIndicator": "string", #二级指标
                      "thirdIndicator": "string", #三级指标
                      "upload": boolean #是否上传
                    }
        :return:
        """
        url_path = url + f"/teachingqualityevaluationapi/v1/thirdindicator/file/download"
        r = requests.post(url=url_path, headers=headers, params=params, json=body)
        return r

    @classmethod
    def get_indicator_dimension_flow(cls, url: str, headers=headers_web, params=None, params_path=None):
        """
        @Summary: 获取指标维度资料流程接口
        @Description: 1、云课堂管理端指标维度资料调用
        :param headers:{
                          "Content-Type":"application/json",
                          "X-Requested-With":"XMLHttpRequest",
                          "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64)
                          AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36"
                        }
        :param url: http://192.168.1.32:8080
        :param params: {validCode: "string" #验证码（id={}&signKey=123123）}
        :param params_path: "string" # 课程资料ID
        :return: [{
                    "flowName": "string", #流程名称
                    "flowOperatorId": "string", #流程操作人ID
                    "flowOperatorName": "string", #流程操作人姓名
                    "flowOperatorNo": "string", #流程操作人工号
                    "flowOperatorTypeName": "string", #流程操作人类型名称
                    "id": "string" #专业资料ID
                  }]
        """
        url_path = url + f"/teachingqualityevaluationapi/v1/indicatordimensionmaterial/{params_path}/flow"
        r = requests.get(url=url_path, headers=headers, params=params)
        return r

    @classmethod
    def post_third_indicator_page(cls, url: str, headers=headers_web, params=None, body=None):
        """
        @Summary: 获取三级指标维度资料列表
        @Description: 1、云课堂管理端指标维度资料调用
        :param url: http://192.168.1.32:8080
        :param headers:{
                      "Content-Type":"application/json",
                      "X-Requested-With":"XMLHttpRequest",
                      "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64)
                      AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36"
                    }
        :param params: {validCode: string #验证码（&signKey=123123）}
        :param body: {
                      "auditStatus": integer, #审核状态：0-未审核，1-审核通过，2-审核不通过
                      "collegeId": "string", #学院ID
                      "isTeachingQualityEvaluationAdmin": boolean, #是否校管理员 0：否；1：是
                      "operatorId": "string", #操作人ID
                      "page": integer, #当前页
                      "primaryIndicator": "string", #一级指标
                      "secondaryIndicator": "string", #二级指标
                      "pageSize": integer, #每页数量
                      "sortName": "string", #排序字段 uploadTime:上传时间，不传或者其他值使用默认排序
                      "sortRule": "string", #排序规则：asc：升序；desc：降序
                      "thirdIndicator": "string", #三级指标
                      "upload": boolean #是否上传：0-否，1-是
                    }
        :return:{
                  "ThirdIndicatorsVoList": [
                    {
                      "auditStatus": integer, #审核状态：0-审核退回，1-院长未确认，2-院长已确认
                      "collegeName": "string", #上传学院
                      "id": "string", #id
                      "primaryIndicator": "string", #一级指标
                      "remark": "string", #备注
                      "secondaryIndicator": "string", #二级指标
                      "thirdIndicator": "string", #三级指标
                      "upload": boolean, #是否上传
                      "uploadTime": "string" #上传时间
                    }
                  ],
                  "page": integer, #当前页码
                  "pageCount": integer, #总页数
                  "totalCount": integer #总条数
                }
        """
        url_path = url + "/teachingqualityevaluationapi/v1/thirdindicatorpage"
        r = requests.post(url=url_path, params=params, headers=headers, json=body)
        return r


if __name__ == '__main__':
    pass
